﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CaramelEngine.Dice
{
    public class ModifiableDice : Dice, IModifiableDice
    {
        public int MinimumRollModifier { get; set; }

        public int MaximumRollModifier { get; set; }

        /// <summary>
        /// Create a die that can have modifiers applied to the rolls.
        /// </summary>
        /// <param name="sides">Number of faces the die has. Default 6.</param>
        /// <param name="minRollModifier">Number that the minimum roll amound has added to it. Default 0.</param>
        /// <param name="maxRollModifier">Number that the maximum roll amound has added to it. Default 0.</param>
        public ModifiableDice(int sides = 6, int minRollModifier = 0, int maxRollModifier = 0) : base(sides)
        {
            MinimumRollModifier = minRollModifier;
            MaximumRollModifier = maxRollModifier;
        }

        /// <summary>
        /// Returns a value between one plus the minimum modifier and the highest side + maximum modifier.
        /// </summary>
        /// <returns>Integer of the rolled value.</returns>
        public override int Roll()
        {
            return Rand.Next(1 + MinimumRollModifier, DiceSides + MaximumRollModifier);
        }
    }
}
